<?php
//No direct access
defined('_JEXEC') or die('Restricted access');

class Ownservice
{
	function checkAccess($acoSection, $aco, $axoSection = null, $axo = null){

		//Initialise variables
		$user		= & JFactory::getUser();
		$acl		= & JFactory::getACL();
		$db			= & JFactory::getDBO();
		$Ownuser	= & Ownservice::getUser();

		$value = $Ownuser->get('level_name');

		return $acl->acl_check($acoSection, $aco,	'users', $value, $axoSection, $axo);
	}
	
	function getUser($id = null){

		jimport('joomla.user.user');

		if(is_null($id))
		{
			$session  =& JFactory::getSession();
			$instance =& $session->get('ownservice');
			if (!is_a($instance, 'JUser')) {
				$instance =& JUser::getInstance();
			}
		}
		else
		{
			$instance =& JUser::getInstance($id);
		}

		return $instance;
	}
}